//
//  UIImage+ExtraImage.m
//  SanMuHui
//
//  Created by user on 2017/10/12.
//  Copyright © 2017年 Dnake. All rights reserved.
//

#import "UIImage+ExtraImage.h"

@implementation UIImage (ExtraImage)

+ (UIImage *)base64ChangeImageWithEncode:(NSString *)encode {
    if (encode == nil || [encode isEqualToString:@""] || [encode isEqualToString:@"<null>"]) {
        return [UIImage imageNamed:@"balidao.jpeg"];
    }
    NSData *decodedImageData = [[NSData alloc] initWithBase64EncodedString:encode options:0];
    UIImage *decodedImage = [UIImage imageWithData:decodedImageData];
    return decodedImage;
}

+ (NSString *)imageChangeBasr64StringWithImage:(UIImage *)image {
    if (image == nil ) {
        image = [UIImage imageNamed:@"balidao.jpeg"];
    }
    NSData *data = UIImageJPEGRepresentation(image, 1.0f);
    NSString *encodedImageStr = [data base64EncodedStringWithOptions:0];
    return encodedImageStr;
}
 

@end
